# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=zoxide
pkgver=0.9.2
pkgrel=0
pkgdesc="Faster way to navigate your filesystem"
url="https://github.com/ajeetdsouza/zoxide"
# s390x: https://github.com/nix-rust/nix/issues/1968
arch="all !s390x"
license="MIT"
makedepends="cargo cargo-auditable"
checkdepends="dash bash fish shfmt zsh"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/ajeetdsouza/zoxide/archive/v$pkgver/zoxide-$pkgver.tar.gz
	exclude-shellcheck-test.patch
	"

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/zoxide -t "$pkgdir"/usr/bin/

	install -Dm644 man/man1/*.1 -t "$pkgdir"/usr/share/man/man1/

	cd contrib/completions
	install -Dm644 zoxide.bash "$pkgdir"/usr/share/bash-completion/completions/zoxide
	install -Dm644 zoxide.fish -t "$pkgdir"/usr/share/fish/vendor_completions.d/
	install -Dm644 _zoxide -t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
a45e6e6b071a10da634a067562630fbd14f47a6de4dba87a5a690b2e4c4c590b8650844ef2c90f64c9817d29f5ffa55db9582435477d734b5bf8aa536109ecb3  zoxide-0.9.2.tar.gz
78f53af62460aec5db610ed7a47344f4386b1a0129f05b9b392cbd588d5c8ea10a18a48c9c8ef34bc73436aeaf0e3e6eecc50c99425b3efdec266d4f862dbf78  exclude-shellcheck-test.patch
"
